﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;
using CommonExtensions.StringExtensions;
using StructureMap;

namespace DBMigrator.Core.DbObjects.Data.Insert
{
    public class InsertIntoOptions<T> : IInsertIntoOptions<T>
    {
        public Type SqlGenerationType
        {
            get { return typeof (IInsertIntoOptions); }
        }

        public string TableName { get; private set; }
        private IInsertIntoValues<T> GenericInsertIntoValues { get; set; }
        
        public IInsertIntoValues InsertIntoValues 
        { 
            get { return GenericInsertIntoValues; }
        }


        public InsertIntoOptions(IInsertIntoValues<T> genericInsertIntoValues)
        {
            if(genericInsertIntoValues.IsNull())
                throw new ArgumentNullException("genericInsertIntoValues");

            GenericInsertIntoValues = genericInsertIntoValues;
        }

        public IInsertIntoValues<T> Table(string tableName)
        {
            if(tableName.IsBlank())
                throw new ArgumentNullException("tableName");

            TableName = tableName;

            return GenericInsertIntoValues;
        }
    }
}
